<SCRIPT language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</SCRIPT>
<?
include("db.php");
session_start();
if(!isset($_SESSION['login'])){
	echo "<script>window.location='login.php'</script>";
}
else{
	$login=$_SESSION['login'];
}
if(isset($_POST['senha_1'])){
	$senha1=$_POST['senha_1'];
	$senha2=$_POST['senha_2'];
	$senha3=$_POST['senha_3'];
	if($senha2!=$senha3){
		echo "<script>alert('Senha e Redigitação de senha diferentes');window.location='logoff.php'</script>";
	}
	else{
		$sql="UPDATE MEMB_INFO SET memb__pwd='$senha2' WHERE memb___id='$login' AND memb__pwd='$senha1'";
		$res=mssql_query($sql);
		echo "<script>alert('Senha alterada com sucesso');window.location='logoff.php'</script>";
	}

}
?>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	width:100%;
	height:100%;
}
.login {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: bold;
	color: #003366;
	text-decoration: none;
}
.campos {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: normal;
	color: #003366;
	text-decoration: none;
	border: 1px solid #003366;
}
a:link {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
}
a:visited {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
}
a:hover {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	font-weight: bold;
	color: #666666;
	text-decoration: none;
}
.style1 {color: #FFFFFF}
#ie5menu{
position:absolute;
width:120px;
border:2px solid black;
background-color:menu;
font-family:Verdana;
font-size: 11px;
line-height:17px;
cursor:default;
visibility:hidden;
}
.menuitems{
padding-left:15px;
padding-right:15px;
}
-->
</style>

<html>
<head>
<script>
function mudar(){
	erro='';
	if( document.form1.senha_1.value==''){ erro+='Senha está em branco \n'; }
	if( document.form1.senha_2.value==''){ erro+='Nova senha está em branco \n'; }
	if( document.form1.senha_3.value==''){ erro+='Redigite nova senha \n'; }
	if( erro != ''){ alert(erro); }
	else { document.form1.submit() }
}
var display_url=0
function showmenuie5(){
var rightedge=document.body.clientWidth-event.clientX
var bottomedge=document.body.clientHeight-event.clientY
if (rightedge<ie5menu.offsetWidth)
ie5menu.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth
else
ie5menu.style.left=document.body.scrollLeft+event.clientX
if (bottomedge<ie5menu.offsetHeight)
ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight
else
ie5menu.style.top=document.body.scrollTop+event.clientY
ie5menu.style.visibility="visible"
return false
}
function hidemenuie5(){
ie5menu.style.visibility="hidden"
}
function highlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor="highlight"
event.srcElement.style.color="white"
if (display_url==1)
window.status=event.srcElement.url
}
}
function lowlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor=""
event.srcElement.style.color="black"
window.status=''
}
}
function jumptoie5(){
if (event.srcElement.className=="menuitems")
window.location=event.srcElement.url
}
</script>
<title>Untitled Document</title>
</head>
<body scroll=no onLoad="hidemenuie5()">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" bordercolor="#000000" bgcolor="#000000"><form name="form1" method="post" action="password.php">
	<table width="205" border="0" cellpadding="0" cellspacing="0" bgcolor="#666666" class="login">
      <tr>
        <td width="205" bordercolor="#000000" bgcolor="#000000"><font color="#FFFFFF">Senha antiga: </font></td>
      </tr>
      <tr>
        <td bordercolor="#000000" bgcolor="#000000"><font color="#FFFFFF">
          <input name="senha_1" type="password" class="campos" id="senha_1" size="50">
        </font></td>
      </tr>
      <tr>
        <td bordercolor="#000000" bgcolor="#000000"><font color="#FFFFFF">Senha NOVA:</font></td>
      </tr>
      <tr>
        <td bordercolor="#000000" bgcolor="#000000"><font color="#FFFFFF">
          <input name="senha_2" type="password" class="campos" id="senha_2" size="50">
        </font></td>
      </tr>
      <tr>
        <td bordercolor="#000000" bgcolor="#000000"><font color="#FFFFFF">Redigite senha NOVA:</font> </td>
      </tr>
      <tr>
        <td bordercolor="#000000" bgcolor="#000000"><font color="#FFFFFF">
          <input name="senha_3" type="password" class="campos" id="senha_3" size="50">
        </font></td>
      </tr>
      <tr>
        <td bordercolor="#000000" bgcolor="#000000"><div align="right"><font color="#FFFFFF">
          <input name="Button" type="button" class="campos" value="Voltar" onClick="javascript:history.go(-1)">
          <input name="Button" type="button" class="campos" value="Mudar" onClick="mudar()">
        </font></div></td>
      </tr>
    </table>
	
    </form></td>
  </tr>
</table>
<!--[if IE]>
<div id="ie5menu" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5()">
<div class="menuitems" url="javascript:history.go(0)">Atualizar</div>
<div class="menuitems" url="javascript:history.go(-1)">Voltar</div>
<div class="menuitems" url="info.php">Principal</div>
</div>
<![endif]-->
<script language="JavaScript1.2">
document.oncontextmenu=showmenuie5
if (document.all&&window.print)
document.body.onclick=hidemenuie5
</script> 
</body>
</html>
